<!--header-->
<!--# include virtual="/ceca_two/common/html/header.html"-->
<link rel="stylesheet" href="/ceca_two/css/supplierInfomation.css" />
<link rel="stylesheet" href="/ceca_two/css/construction.css" />
<style>
	.layer-anim {
		width: 625px !important;
	}
	.layui-laydate-content td.laydate-selected {
		background-color: #f391a9!important;
		color: #ffffff;
	}
	 .gjss{
		 float: right;
		 background: #ff3030;
		 color: #fff;
		 padding: 0 20px;
		 margin-right: 53px;
		 cursor: pointer;
	 }
</style>
<!--banner-->
<!--# include virtual="/ceca_two/common/html/banner.html"-->
<div class="content">
	<div class="navClassify">
		<div class="allClassift">
		</div>
		<div class="ClassiftForm">
			<input type="text" name="" id="gcmc" value="" class="ClassiftInput" placeholder="请输入您要搜索的工程名称"/>
			<button class="ClassiftBtn">搜索</button>
			<button class="searchBtn searchListPrice">查询清单单价</button>
			<button class="searchBtn searchMeterPrice">查询每平米消耗量</button>
		</div>
	</div>
	<div class="classifyNav">
		<ul class="result clearfloat" >
			<li class="allresult">搜索条件</li>
			<li class="last" onclick="window.location.href='/ceca_two/modules/costnorm/construction.html'">清空筛选结果</li>
		</ul>
		<div class="nature jzfl">
			<p class="useNature">建筑分类</p>
			<ul class="natureUl"></ul>
		</div>
		<div class="nature syxz">
			<p class="useNature">使用性质</p>
			<ul class="natureUl"></ul>
		</div>
		<div class="region">
			<div class="useNature">地区</div>
			<div class="regionText">全国</div>
			<div class="cityList">
				<li>更换</li>
				<dl></dl>
				<dl style="left: 150px;"></dl>
			</div>
		</div>
	</div>
	<div class="advanced clearfloat layui-form">
		<div class="fl">高级筛选</div>
		<div class="fr">
			<div class="layui-form-item">
				<label class="layui-form-label">编制时间</label>
				<div class="layui-input-inline">
					<input type="text" name="date" id="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" readonly="">
				</div>
				<label class="layui-form-label">结构类型</label>
				<div class="layui-input-inline" id="jglx">
					<select name="quiz1">
						<option value="">请选择结构类型</option>
						<option>请选择</option>
						<option value="框架结构">框架结构</option>
						<option value="剪力墙结构">剪力墙结构</option>
						<option value="框架-剪力墙结构">框架-剪力墙结构</option>
						<option value="筒体结构">筒体结构</option>
						<option value="部分框支剪力墙结构">部分框支剪力墙结构</option>
						<option value="板柱-剪力墙结构">板柱-剪力墙结构</option>
						<option value="钢结构">钢结构</option>
						<option value="砖混结构">砖混结构</option>
						<option value="其他结构">其他结构</option>
					</select>
				</div>
				<label class="layui-form-label">地上层数</label>
				<div class="layui-input-inline" id="dscs">
					<select name="quiz2">
						<option value="">请选择地上层数</option>
						<option>请选择</option>
						<option value="0~10层">0~10层</option>
						<option value="11~20层">11~20层</option>
						<option value="21~30层">21~30层</option>
						<option value="31~40层">31~40层</option>
						<option value="41~50层">41~50层</option>
						<option value="50层以上">50层以上</option>
					</select>
				</div>
				<label class="layui-form-label">地下层数</label>
				<div class="layui-input-inline" id="dxcs">
					<select name="quiz3">
						<option value="">请选择地下层数</option>
						<option>请选择</option>
						<option value="0~2层">0~2层</option>
						<option value="3~4层">3~4层</option>
						<option value="4层以上">4层以上</option>
					</select>
				</div>
				<label class="layui-form-label">造价类别</label>
				<div class="layui-input-inline" id="zjlb">
					<select name="quiz4">
						<option value="">请选择造价类别</option>
						<option>请选择</option>
						<option value="全过程造价咨询">全过程造价咨询</option>
						<option value="最高投标限价">最高投标限价</option>
						<option value="竣工结算">竣工结算</option>
						<option value="标底价">标底价</option>
						<option value="投标价">投标价</option>
						<option value="合同价">合同价</option>
						<option value="设计概算">设计概算</option>
						<option value="施工图预算">施工图预算</option>
						<option value="经济评价">经济评价</option>
						<option value="投资估算">投资估算</option>
						<option value="工程造价鉴定">工程造价鉴定</option>
						<option value="全过程工程咨询">全过程工程咨询</option>
						<option value="竣工决算">竣工决算</option>
					</select>
				</div>
				<div class="gjss">高级搜索</div>
			</div>
		</div>
	</div>

	<div class="screen">
		<!-- 列表位置  -->
		<div class="screenList" id="screenList"></div>
		<div id="fyq" style="text-align:center;margin:20px 0px"></div>
	</div>
</div>
<!--底部-->
<!--# include virtual="/ceca_two/common/html/footer.html"-->
<script type="text/html" id="allList">
{{# for (var i = 0 ; i < d.length ; i++){ }}
	<div class="screenListText">
		{{# var annex = d[i].annex; annex = JSON.parse(annex || '{"annexStereogram":[]}');var imgUrl =annex.annexStereogram[0] || {url:'/ceca_two/img/cost.jpg'} }}
		<img style="width: 206px;height: 136px;" src="{{imgUrl.url}}" class="screenListImg" />		
		<ul class="screenListUl">
			<li><a href="/ceca_two/modules/costnorm/projectProfile.html?costId={{d[i].costId}}&catalogId={{d[i].catalogId}}" target="_black"><h1 class="screenListName">{{d[i].costName}}</h1></a></li>
			<li>工程地点：<span>{{d[i].address}}</span></li>
			<li>地上层数：<span class="red">{{d[i].overFloor}}层</span></li>
			<li>地下层数：<span class="red">{{d[i].underFloor}}层</span></li>
			<li>编制日期：<span>{{d[i].compilationTime}}</span></li>
		</ul>
		<ul class="screenListUl mt40">
			<li>建筑面积：<span class="red">{{d[i].constructionArea}}㎡</span></li>
			<li>结构类型：<span>{{d[i].structureType}}</span></li>
			<li>计价方式：<span>{{d[i].valuation}}</span></li>
			<li>造价类别：<span>{{d[i].costType}}</span></li>
		</ul>
		<div class="screenMoney" style="margin: 40px 0 0 0;">
			<span class="screenListUnit" style="margin: 40px 20px 0 0; display: inline-block;">单位造价</span>
			<span class="red">{{d[i].unitCost}}</span>元/㎡
		</div>
		
	</div>
{{#  } }}
</script>
<script src="/ceca_two/lib/layui2.26/lay/modules/laydate.js"></script>
<script type="text/javascript">
	layui.use(['construction','layer',"Router",'laytpl','laypage','Zutil','form'], function() {
		var Zutil  =layui.Zutil;
		var Router = layui.Router;
		var laytpl= layui.laytpl;
		var laydate= layui.laydate;
		var layer = layui.layer;
		var laypage =layui.laypage;
		var form = layui.form;
		var listObj = {};
        var areaList;
			listObj.pageNumber = Zutil.getQueryString("pageNumber") || 1;
			listObj.pageSize = Zutil.getQueryString("pageSize") || 10;
        	Zutil.getQueryString("nature") ? listObj.nature = Zutil.decodeURI(window.atob(Zutil.getQueryString("nature"))) : "" ;
        	Zutil.getQueryString("address") ? listObj.address = Zutil.decodeURI(window.atob(Zutil.getQueryString("address"))) : "" ;
        	Zutil.getQueryString("catalogThird") ? listObj.catalogThird = Zutil.decodeURI(window.atob(Zutil.getQueryString("catalogThird"))) : "" ;
        	Zutil.getQueryString("catalogSecond") ? listObj.catalogSecond = Zutil.decodeURI(window.atob(Zutil.getQueryString("catalogSecond"))) : "" ;
        	Zutil.getQueryString("catalogOne") ? listObj.catalogOne = Zutil.decodeURI(window.atob(Zutil.getQueryString("catalogOne"))) : "" ;
        	Zutil.getQueryString("catalog") ? listObj.catalog = Zutil.decodeURI(window.atob(Zutil.getQueryString("catalog"))) : "" ;
        	Zutil.getQueryString("costName") ? listObj.costName = Zutil.decodeURI(window.atob(Zutil.getQueryString("costName"))) : "" ;

        if( Zutil.getQueryString("catalogThird") ){
            drawJZFL(Zutil.decodeURI(window.atob(Zutil.getQueryString("catalogThird"))) , 5)
        }else if( Zutil.getQueryString("catalogSecond") ){
            drawJZFL(Zutil.decodeURI(window.atob(Zutil.getQueryString("catalogSecond"))) , 4)
		}else if ( Zutil.getQueryString("catalogOne") ){
            drawJZFL(Zutil.decodeURI(window.atob(Zutil.getQueryString("catalogOne"))) , 3)
		}else if (Zutil.getQueryString("catalog")){
            drawJZFL(Zutil.decodeURI(window.atob(Zutil.getQueryString("catalog"))) , 2)
        }else{
            drawJZFL(1 , 1)
		}
		// 建筑分类
		function drawJZFL (pid , level) {
            $.ajax({
                type:"post",
                url:"/guidance_service/front/data/catalog/getCatalogs.do",
                success : function (result){
                    if (result.resultCode === 200){
                        if( level == 1 ){
                            for ( i = 0 ; i < result.data.length ; i++){
                                if( result.data[i].parentId == 1){
                                    $(".jzfl").find(".natureUl").append("<li onclick='chooseCatalog(this , "+level+")'  data-catalogId='"+result.data[i].catalogName+"'>"+ result.data[i].catalogName+"</li>")
                                }
                            }
                        }else{
                            for ( i = 0 ; i < result.data.length ; i++){
                                if( result.data[i].catalogName == pid){
                                    var thisId = result.data[i].catalogId;
                                    if (result.data[i].characteristics){
                                        var characteristics;
                                        if(result.data[i].characteristics.indexOf(",") == -1){
                                            characteristics = result.data[i].characteristics.split("，");
                                        }else{
                                            characteristics = result.data[i].characteristics.split(",");
                                        }
										for ( j = 0 ; j < characteristics.length ; j++ ) {

                                            if( characteristics[j] != listObj.nature){
                                                $(".syxz").find(".natureUl").append("<li onclick='chooseNature(this)'>"+characteristics[j]+"</li>")
                                            }
										}
									}else{
                                        $(".syxz").remove();
									}
                                    for ( j = 0 ; j < result.data.length ; j++ ) {
                                        if(  result.data[j].parentId == thisId){
                                            $(".jzfl").find(".natureUl").append("<li onclick='chooseCatalog(this , "+level+")'  data-catalogId='"+result.data[j].catalogName+"'>"+ result.data[j].catalogName+"</li>")
                                        }
                                    }
                                    break;
                                }
                            }
						}

                    }
                },error : function (){

                }
            });
        }

        chooseCatalog = function (modern , level) {
			var thisCatalogId = $(modern).attr("data-catalogid");
		    if( level == 1 ){
                listObj.catalog = thisCatalogId ;
                makeUrl(listObj);
		    }
			if( level == 2 ){
                listObj.catalogOne = thisCatalogId ;
                makeUrl(listObj);
			}
			if( level == 3 ){
                listObj.catalogSecond = thisCatalogId ;
                makeUrl(listObj);
			}
            if( level == 4 ){
                listObj.catalogThird = thisCatalogId ;
                makeUrl(listObj);
            }
        };

        chooseNature = function (modern) {
			var nature = $(modern).html();
            listObj.nature = nature ;
            makeUrl(listObj);
        };

        delTag = function (modern) {
			var thisName = $(modern).attr("data-class");
            delete listObj[thisName];
			makeUrl(listObj)

        };

        function makeUrl(obj){
            var searchUrl = window.location.pathname+"?";
            obj.catalog ? searchUrl+="&catalog="+window.btoa(Zutil.encodeURI(obj.catalog )): "" ;
            obj.catalogOne ? searchUrl+="&catalogOne="+window.btoa(Zutil.encodeURI(obj.catalogOne )) : "" ;
            obj.catalogSecond ? searchUrl+="&catalogSecond="+window.btoa(Zutil.encodeURI(obj.catalogSecond )) : "" ;
            obj.catalogThird ? searchUrl+="&catalogThird="+window.btoa(Zutil.encodeURI(obj.catalogThird )) : "" ;
            obj.pageNumber ? searchUrl+="&pageNumber="+obj.pageNumber : "" ;
            obj.pageSize ? searchUrl+="&pageSize="+obj.pageSize : "" ;
            obj.nature ? searchUrl+="&nature="+window.btoa(Zutil.encodeURI(obj.nature )) : "" ;
            obj.address ? searchUrl+="&address="+window.btoa(Zutil.encodeURI(obj.address )) : "" ;
            obj.costName ? searchUrl+="&costName="+window.btoa(Zutil.encodeURI(obj.costName )) : "" ;
            window.location.href = searchUrl;
        }


        $.getJSON("/ceca_two/router/areaSecond.json",function (result) {
             areaList = result;
             for ( i = 0 ; i < areaList.length ; i++ ) {
                 $(".cityList").find("dl").eq(0).append("<dd data-code='"+areaList[i].code+"' onmouseover='showNext(this)' onclick='chooseThis(this)' >"+areaList[i].name+"</dd>");
             }
        });


        laydate.render({
            elem: '#date'
            ,type: 'date'
            ,range: true,
            theme : "#ff3030"
        });
		// 列表渲染
		getList(listObj);
        function getList(obj){
            $("#screenList").empty();
            $(".result").children("li:not([class])").remove();
            if(obj.catalog){
            	$(".result .last").before("<li data-class='catalog' onclick='delTag(this)'>工程类别："+obj.catalog+"</li>");
            }
            if(obj.catalogOne){
            	$(".result .last").before("<li data-class='catalogOne' onclick='delTag(this)'>建筑分类："+obj.catalogOne+"</li>");
            }
            if(obj.catalogSecond){
            	$(".result .last").before("<li data-class='catalogSecond' onclick='delTag(this)'>建筑分类："+obj.catalogSecond+"</li>") 
            }
            if(obj.catalogThird){
            	$(".result .last").before("<li data-class='catalogThird' onclick='delTag(this)'>建筑分类："+obj.catalogThird+"</li>");
            }
            if(obj.nature){
            	$(".result .last").before("<li data-class='nature' onclick='delTag(this)'>使用性质："+obj.nature+"</li>");
            	$(".syxz").hide();
            }
            if(obj.address){
            	$(".result .last").before("<li data-class='address' onclick='delTag(this)'>地址："+obj.address+"</li>");
            	$(".regionText").html(obj.address);
            }
            if(obj.compilationTime){
            	$(".result .last").before("<li data-class='compilationTime' onclick='delTag(this)'>编制时间："+obj.compilationTime+"</li>")
            }
            if(obj.structureType){
            	$(".result .last").before("<li data-class='structureType' onclick='delTag(this)'>结构类型："+obj.structureType+"</li>");
            }
            if(obj.overFloor){
            	$(".result .last").before("<li data-class='overFloor' onclick='delTag(this)'>地上层数："+obj.overFloor+"</li>");
            }
            if(obj.underFloor){
            	$(".result .last").before("<li data-class='underFloor' onclick='delTag(this)'>地下层数："+obj.underFloor+"</li>");
            }
            if(obj.costType){
            	$(".result .last").before("<li data-class='costType' onclick='delTag(this)'>造价类别："+obj.costType+"</li>");
            }
            if(obj.costName){
            	$("#gcmc").val(obj.costName);
            }

		    $.ajax({
		    	type:"post",
		    	url:"/guidance_service/front/data/search.do",
		        data: obj,
		        success : function (result){
		            if (result.resultCode === 200 && result.data && result.data.list.length > 0){
                        var data = result.data;
                        var list = allList.innerHTML;
                        laytpl(list).render(data.list, function(html){
                            $("#screenList").html(html);
                             if($(".jzfl").find("li").size()<1){
				            	$(".jzfl").hide();
				            }
                        });
                        laypage({
                            cont: 'fyq'
                            ,pages: data.totalPage
                            ,curr:data.pageNumber
                            ,groups:data.pageSize
                            ,skin: '#ff0000'
                            ,jump: function(opt, first){
                                var curr = opt.curr;   //当前的页码
                                listObj.pageNumber = curr|| 1;
                                if(!first)makeUrl(listObj)
                            }
                        });
		            }else{
                        $("#screenList").append("<h1 style='width: 100%;text-align: center;font-size: 30px;background: #fff;padding: 50px; margin: 35px 0;box-sizing: border-box'>暂无相关信息</h1>")
                    }
		        },error : function (){

		        }
		    });
		   

		}
        
        $(".searchListPrice").on("click",function () {
            layer.open({
                type: 2,
                title: '查询清单单价',
                shadeClose: true,
                shade: false,
                maxmin: true,
                area: ['893px', '660px'],
                content: '/ceca_two/modules/costnorm/base/searchListPrice.html'
            })
        });
        $(".searchMeterPrice").on("click",function () {
            layer.open({
                type: 2,
                title: '查询每平米消耗量',
                shadeClose: true,
                shade: false,
                maxmin: true,
                area: ['893px', '660px'],
                content: '/ceca_two/modules/costnorm/base/searchMeterPrice.html'
            })
        });
        $(".cityList").on("click",function () {
            $(this).find("dl").show();
        });
        showNext = function (modern) {
            var thisCode = $(modern).attr("data-code");
            for ( i = 0 ; i < areaList.length ; i++ ) {
                if( thisCode === areaList[i].code){
                    $(".cityList").find("dl").eq(1).show().empty();
                    for ( j = 0 ; j < areaList[i].child.length ; j++ ) {
                        $(".cityList").find("dl").eq(1).append("<dd data-code='"+areaList[i].child[j].code+"' onmouseover='showNext(this)' onclick='chooseThis(this)' >"+areaList[i].child[j].name+"</dd>");
                    }
                }
            }
        };

        chooseThis = function (modern) {
            var thisCode = $(modern).attr("data-code");
            var thisHtml = $(modern).html();
            $(modern).parents(".cityList").find("dl").hide();
            $(".regionText").html(thisHtml).attr(thisCode);
            listObj.address = thisHtml ;
            makeUrl(listObj);
            window.event ? window.event.cancelBubble = true : e.stopPropagation();
        };

        $(".gjss").on("click",function () {
            listObj.compilationTime = $("#date").val();
            listObj.structureType = $("#jglx").find("input").val();
            listObj.overFloor = $("#dscs").find("input").val();
            listObj.underFloor = $("#dxcs").find("input").val();
            listObj.costType = $("#zjlb").find("input").val();
			getList(listObj)
        });

		$(".ClassiftBtn").on("click",function () {
			var costName = $("#gcmc").val();
            listObj.costName = costName;
			makeUrl(listObj)
        });

		function determine (value) {
		    var result;
			if (value == "" || value == undefined){
                result = false ;
			}else{
			    result = true ;
			}
			return result;
        }
	});
</script>
</body>
</html>